package cn.sdc.bugKiller.web;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.sdc.bugKiller.bean.HomeBean;
import cn.sdc.bugKiller.service.BugDealService;
import cn.sdc.bugKiller.service.ContextService;

public class HomeServlet extends BasicServlet {
	
	public static String HOME_BEAN = "homeBean";
	
	private static BugDealService service = new BugDealService();
	
	public void exceute(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		
		HomeBean bean = new HomeBean();
		bean.setUnfixBugCount(service.countUnfixBug());
		bean.setApprovalBugCount(service.countApprovalBug());
		bean.setClosedBugCount(service.countClosedBug());
		bean.setAllBugCount(service.countAllBug());
		bean.setUrgentlyBugList(service.getUrgentlyBugList());
		bean.setNewBugList(service.getNewlyBugList());
		req.setAttribute(HOME_BEAN, bean);
		
		setMenu(MENU_HOME);
		
		forward(req, resp, URI_HOME_JSP);
	}
}
